package com.dayuanit.dy15.lesson23.demo2;

import java.util.LinkedList;

public class Test {

    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("tom");
        linkedList.addFirst("bob");
        linkedList.addLast("jack");
        linkedList.add("zhangsan");//链表默认添加时在尾部添加
        for (String item : linkedList) {
            System.out.println(item);
        }

        System.out.println("----------------");

        MyLinkedList myLinkedList = new MyLinkedList();
//        myLinkedList.addFirst("tom");
//        myLinkedList.addFirst("bob");
//        myLinkedList.addLast("lisi");
//        myLinkedList.addFirst("jack");
//        myLinkedList.addFirst("hanmm");

        myLinkedList.add("tom");
        myLinkedList.add("bob");
        myLinkedList.add("lisi");
        myLinkedList.add("jack");
        myLinkedList.add("hanmm");

//        System.out.println(myLinkedList.get(3));

//        myLinkedList.remove(0);
//
        System.out.println(myLinkedList.size());
        for (int i=0; i<myLinkedList.size(); i++) {
            System.out.println(myLinkedList.get(i));
        }
    }
}
